/*
 * onewire.h
 *
 *  Created on: 15/01/2015
 *      Author: santiago
 */

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

#include <inc/lm4f120h5qr.h>
#include <driverlib/rom.h>
#include <inc/hw_memmap.h>
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
#include <inc/hw_gpio.h>
#include <inc/hw_ints.h>
#include <inc/hw_memmap.h>
#include <inc/hw_types.h>
#include <driverlib/debug.h>
#include <driverlib/fpu.h>
#include <driverlib/gpio.h>
#include <driverlib/interrupt.h>
#include <driverlib/pin_map.h>
#include <driverlib/sysctl.h>
#include <driverlib/timer.h>

#include "../gdefines.h"

#ifndef ONEWIRE_H_
#define ONEWIRE_H_

#define MAXDISPOSITIVOS 20

typedef unsigned char bool_t;
typedef struct owDevice {
	uint8_t romAddr[8];
//	struct owDevice *NextDevice;
}owDevice_t;


/**
 * Prototipos de funciones
 */

void owInit(void);

bool_t owReset(void);

error_t owSearchRom(owDevice_t *newdevices, uint8_t * encontrados);

static bool_t owRDBit(void);

static void owWRBit(bool_t);

error_t owSendCmd(uint8_t);

static error_t owSendBif(owDevice_t *, uint8_t *, uint8_t *, uint8_t);

error_t owSendMatchRom(owDevice_t *);

error_t owReadBytes(uint8_t , uint8_t*);

error_t owReadByte(uint8_t *);

error_t owWaitPin(uint32_t);

#endif /* ONEWIRE_H_ */

